import request from '../request'

const Api = {
  page: '/api/adminteachingMaterial/teachingMaterial/page',
  schoolPage: '/api/adminschool/school/page',
  remove: '/api/adminteachingMaterial/teachingMaterial/remove',
  save: '/api/adminteachingMaterial/teachingMaterial/save',
  details: '/api/adminteachingMaterial/teachingMaterial/selectById',
  upload: '/api/sys/oss/upload',
  dictionary: '/api/sys/dict/data/getList',
  update: '/api/adminteachingMaterial/teachingMaterial/update'
}

export const remove = params => {
  return request.request({
    url: Api.remove,
    params,
    method: 'DELETE'
  })
}
// 教材的分页
export const page = params => {
  return request.request({
    url: Api.page,
    params,
    method: 'GET'
  })
}
// 获取学校分页
export const schoolPage = params => {
  return request.request({
    url: Api.schoolPage,
    params,
    method: 'GET'
  })
}

/** 新增教材管理基本信息 */
export const save = data => {
  return request.request({
    url: Api.save,
    data,
    method: 'POST'
  })
}
/** 查看教材管理基本信息 */
export const details = params => {
  return request.request({
    url: Api.details,
    params,
    method: 'GET'
  })
}
/** 文件上传 */
export const upload = data => {
  return request.request({
    url: Api.upload,
    data,
    method: 'post'
  })
}

/** 数据字典列表 */
export const dictionary = params => {
  return request.request({
    url: Api.dictionary,
    params,
    method: 'GET'
  })
}

/**
 * 编辑
 * @param data
 * @returns {*}
 */
export const update = data => {
  return request.request({
    url: Api.update,
    data,
    method: 'PUT'
  })
}
